package com.cxk.hr.util;

public class PageSuport {

	// 当前页码
	private int currentPageNo = 1;
	// 总数
	private int totalCount = 0;
	// 每页的数量
	private int pageSize = 0;
	// 总页数
	private int totalPageCount = 1;

	public int getCurrentPageNo() {
		return currentPageNo;
	}

	public void setCurrentPageNo(int currentPageNo) {
		if (currentPageNo > 0)
			this.currentPageNo = currentPageNo;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		// 总数大于0
		// 一种刚好整除 总页数 = 总数/每页的数量
		// 不整除且大于0 总页数 = 总数/每页的数量+1
		if (totalCount > 0) {
			this.totalCount = totalCount;
			if (this.totalCount % this.pageSize == 0) {
				this.totalPageCount = this.totalCount / this.pageSize;
			} else if (this.totalCount % this.pageSize > 0) {
				this.totalPageCount = this.totalCount / this.pageSize + 1;
			}
		} else {
			this.totalPageCount = 0;
		}
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalPageCount() {
		return totalPageCount;
	}

	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}

}
